---
title: "Lung cancer_predictions_males"
author: "Smith"
date: "2024-12-26"
output: html_document
---


```{r}

##cargar Norpred

source("nordpred.s")

```


```{r warning=FALSE, message=FALSE}

#cargar archivos

indata <- read.table("Ar",header =T,sep=",",row.names=1)
inpop1 <- read.table("Venezuela_observed_lungcancer.txt", header =T,sep=",",row.names=1)
inpop2 <- read.table("Venezuela_predictions_lungcancer.txt",header =T,sep=",",row.names=1)


```



```{r}
# Include possible population predictions

inpop <- cbind(inpop1,inpop2)

```



```{r}
##starstage 5, ya que empieza aqui la mortalidad

est <-  nordpred.estimate(cases=indata,pyr=inpop,noperiod=3,startestage=4)

```




```{r}
# Fit model using poisson link: 

est2 <- nordpred.estimate(indata,inpop,3,4,linkfunc="poisson")
```


```{r}
# Print results: 
print(est) 
print(est$glm) 
```



```{r}
# Use estimat object to make predictions: 


res <- 
  nordpred.prediction(est,startuseage=4,cuttrend=c(0, 0.25, 0.5, 0.75, 0.75),recent=T) 
```


```{r}
# Predictions cases 

est <- nordpred.estimate(cases=indata,pyr=inpop,noperiod=3,startestage=4) 

```



```{r}
# Print / get results ### # de muertes por año y predicciones 
# Puedo sumar grupos etarios o tomar el grupo etario que desee

print(res) 
```





```{r}

# Get results with standardisation: 

wstand <- c(0.12, 0.1, 0.09, 0.09, 0.08, 0.08, 0.06, 0.06, 0.06, 
            0.06,0.05, 
            0.04, 0.04, 0.03, 0.02, 0.01, 0.005, 0.005) 

round(nordpred.getpred(res,incidence=T,standpop=NULL),2) 
round(nordpred.getpred(res,incidence=T,standpop=wstand),2) 
```



```{r}
# summary results 
est <- summary(res,printpred=F)
```





